package com.java3_1;

public class Demo2 {
    //单例模式
    private Demo2() {

    }

    private static Demo2 demo2 = null;

    public static Demo2 getDemo2() {
        if (demo2 == null) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            demo2 = new Demo2();
        }
        return demo2;
    }


}
